﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace VideoChatClient
{
    /// <summary>
    /// Interaction logic for Window_Main.xaml
    /// </summary>
    public partial class Window_Main : Window
    {
        public Window_Main()
        {
            InitializeComponent();
                    this.Closing +=new System.ComponentModel.CancelEventHandler(Window_Main_Closing);
            
        }

        void Window_Main_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            try
            {
                App.ViewModel.CloseModel();
            }
            catch (Exception)
            {

            }
            //throw new NotImplementedException();
        }

        static void App_Exit(object sender, ExitEventArgs e)
        {

            //throw new NotImplementedException();
        }

        private void Window_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            switch (e.Key)
            {
                case Key.F1:
                    if (frmMain.Content is Page_ClientMain) return;
                    frmMain.NavigationService.Navigate(new Page_ClientMain());
                    break;
                case Key.F2:
                    if (frmMain.Content is Page_Settings) return;
                    frmMain.NavigationService.Navigate(new Page_Settings());
                    break;
                case Key.F5:
                    e.Handled = true;
                    return;
                    break;
            }
        }
    }
}
